{extend name="common/pop" /}
{block name="content"}

<div class="layui-form" style="margin-top:15px;width:90%;">

    <div class="layui-form-item">
        <div class="layui-input-block">
            <div id="transfer"></div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="create">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</div>
{/block}

{block name="script"}
<script>
    layui.use(['layer', 'jquery', 'form','transfer'], function () {
        var form = layui.form,
            layer = layui.layer,
            transfer = layui.transfer,
            $ = layui.jquery;

        form.render();

        form.on('submit(create)', function (data) {
            console.log(data.field);
            return false;
            $.post('{:url("create")}', data.field, function (r) {
                if (r.code == 1) {
                    layer.msg('已提交');
                    close(1500, true);
                } else {
                    layer.msg(r.msg);
                }
            }, 'json')
        });

        transfer.render({
            elem: '#transfer'  //绑定元素
            ,title:['角色','用户角色']
            ,showSearch:true
            ,data: [
                {"value": "1", "title": "李白", "disabled": "", "checked": ""}
                ,{"value": "2", "title": "杜甫", "disabled": "", "checked": ""}
                ,{"value": "3", "title": "贤心", "disabled": "", "checked": ""}
            ]
            ,id: 'transfer' //定义索引
        });
    })
</script>
{/block}